<?
require("config.php");

$Query = "SELECT 
code,
email,
name,
company,
address,
city,
country,
messages,
date 
FROM $table";

$r=myQuery($Query);


header("Content-type:application/vnd.ms-excel");  
header("Content-Disposition:filename=subscription_" . date("Ymd") . ".xls");  

echo "code\t"; 
echo "email\t";  
echo "name\t";
echo "company\t";
echo "address\t"; 
echo "city\t"; 
echo "country\t";
echo "messages\t";
echo "date\t\n";

for ($i=0;$i<count($r);$i++){

echo $r[$i][0] . "\t"; 
echo $r[$i][1] . "\t"; 
echo $r[$i][2] . "\t"; 
echo $r[$i][3] . "\t"; 
echo $r[$i][4] . "\t"; 
echo $r[$i][5] . "\t"; 
echo $r[$i][6] . "\t"; 
echo $r[$i][7] . "\t"; 
echo $r[$i][8] . "\t\n"; 
}
?>